package com.atguigu.bigdata.scala.mytest.chapter02

import java.io.{InputStream, ObjectInputStream}
import java.net.ServerSocket

object Net_Server_Object {
  def main(args: Array[String]): Unit = {
    val serverSocket: ServerSocket = new ServerSocket(8888)
    while (true){
      val socket = serverSocket.accept()
      new Thread(new Runnable {
        override def run(): Unit = {
          val stream: InputStream = socket.getInputStream
          val inputStream = new ObjectInputStream(stream)
          val unit: AnyRef = inputStream.readObject()
          print(unit)
          inputStream.close()
          socket.close()
        }
      }).start()
    }
    serverSocket.close()

  }
}
